package com.saikei.demoapp.db

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Transaction


@Dao
interface UserWithBookDao {

    @Insert
    fun insertUser(user: User): Long

    @Insert
    fun insertBook(books: Book):Long

    @Delete
    fun delete(user: User)

    @Transaction
    @Query("Select * From user")
    fun findBook():List<UserWithBooks>

    @Transaction
    @Query("Select * From user where userId = :userId")
    fun findBookFormUserId(userId:Int):UserWithBooks?

}